<html>
<head><meta charset="utf-8"><title>Viewing representations · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Viewing.20representations.html">Viewing representations</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203571702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Viewing%20representations/near/203571702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nell Shamrell-Harrington <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Viewing.20representations.html#203571702">(Jul 11 2020 at 00:33)</a>:</h4>
<p>Hello everyone!</p>
<p>I know it's possible to view the HIR of a piece of source code with:</p>
<div class="codehilite"><pre><span></span><code>cargo rustc -- -Zunpretty=hir-tree
</code></pre></div>


<p>And you can view the generated MIR, LLVM IR, and Assembly code on Rust Playground.</p>
<p>Is there any way to view the AST that is generated by the compiler for a piece of source code before it is lowered to the HIR?</p>



<a name="203574182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Viewing%20representations/near/203574182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Viewing.20representations.html#203574182">(Jul 11 2020 at 01:32)</a>:</h4>
<p>hmmm, does <code>-Z ast-json</code> still work?</p>



<a name="203574196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Viewing%20representations/near/203574196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Viewing.20representations.html#203574196">(Jul 11 2020 at 01:33)</a>:</h4>
<p>and <code>-Z ast-json-noexpand</code> for pre-expansion I'm guessing</p>



<a name="203574255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Viewing%20representations/near/203574255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Viewing.20representations.html#203574255">(Jul 11 2020 at 01:34)</a>:</h4>
<p>I wonder if we should do something using e.g. <code>serde</code> or even a more specialized derive, that is focused on being nice rather than just a raw dump</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>